import request from '@/utils/request'

export const kaptchaService = () => {
    return request.get('/captcha')
}

export const userLoginService = ({username, password, kaptcha, kaptchaUuid}) => {
    const encodedUsername = btoa(username)
    const encodedPassword = btoa(password)
    return request.post('/login', {
        username: encodedUsername,
        password: encodedPassword,
        kaptcha,
        kaptchaUuid
    })
}

export const userRegisterService = ({username, password}) => {
    const encodedUsername = btoa(username)
    const encodedPassword = btoa(password)
    return request.post('/register', {
        username: encodedUsername,
        password: encodedPassword
    })
}